package iterator_pattern.exercise.exercise1;

/**
 * 客户端主类
 * @author ricejson
 */
public class Main {
    public static void main(String[] args) {
        Iterator iterator = new TechDepartment("技术部").createIterator();
        // 迭代遍历技术部
        System.out.println("技术部员工: ");
        while (!iterator.isDone()) {
            System.out.print(iterator.currentItem() + ",");
            iterator.next();
        }
        iterator = new MarketDepartment("市场部").createIterator();
        System.out.println("\n市场部员工: ");
        while (!iterator.isDone()) {
            System.out.print(iterator.currentItem() + ",");
            iterator.next();
        }
        iterator = new AdministratorDepartment("行政部").createIterator();
        System.out.println("\n行政部员工: ");
        while (!iterator.isDone()) {
            System.out.print(iterator.currentItem() + ",");
            iterator.next();
        }
    }
}
